local sk__daiyan = fk.CreateSkill {

  name = "sk__daiyan",

  tags = {  },

}



sk__daiyan:addEffect(fk.TurnEnd, {
  name = "sk__daiyan",
  anim_type = "control",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(sk__daiyan.name)
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local to = room:askForChoosePlayers(player, table.map(room.alive_players, Util.IdMapper), 1, 1,
      "#sk__daiyan-choose", sk__daiyan.name, true)
    if #to > 0 then
      event:setCostData(self, {tos = to})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = room:getPlayerById(event:getCostData(self).tos[1])
    local mark = player:getTableMark(sk__daiyan.name)
    mark[string.format("%.0f", to.id)] = (mark[string.format("%.0f", to.id)] or 0) + 1
    room:setPlayerMark(player, sk__daiyan.name, mark)
    to:gainAnExtraTurn()
    room:loseHp(to, mark[string.format("%.0f", to.id)], sk__daiyan.name)
  end,
})

return sk__daiyan